package com.tm.d14_method_references;

import java.awt.print.Book;
import java.util.Arrays;

/**
 *2024/5/25 Cjj Car 构造器引用 18:58
 */
public class CarTest {
    public static void main(String[] args) {
    /*   CreateCar c= new CreateCar() {
            @Override
            public Car create(String name, double price) {
                return new Car(name,price);
            }
        };
        System.out.println(c.create("马萨拉蒂", 4444444.7));
*/

        // CreateCar c = (name, price) -> new Car(name, price);

        /**构造器引用**/
        CreateCar c = Car::new;
        Car car = c.create("马萨拉蒂", 4444444.7);
        System.out.println(car);



    }
}
interface CreateCar{
    Car create(String name,double price);
}

